package com.smarttest.portal.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.smarttest.portal.mapper.AuthuserMapper;
import com.smarttest.portal.pojo.Authgroup;
import com.smarttest.portal.pojo.Authuser;
import com.smarttest.portal.pojo.AuthuserExample;
import com.smarttest.portal.pojo.AuthuserExample.Criteria;
import com.smarttest.portal.service.DBUserAuthService;
import com.smarttest.portal.service.LoginService;
@Service
public class LoginServiceImpl implements LoginService {

	@Autowired
	DBUserAuthService userDBAuthService;
	@Autowired
	AuthuserMapper AuthuserMapper;
	@Override
	public List<Authgroup> getMenuByUserId(int id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Authuser getUserInfoByAccount(String name, String pass) {
		// TODO Auto-generated method stub
		AuthuserExample example = new AuthuserExample();
		Criteria critera = example.createCriteria();
		critera.andNameEqualTo(name);
		critera.andUserKeyEqualTo(pass);
		List<Authuser> l = AuthuserMapper.selectByExample(example);
		if (l.size() > 0) {
			return l.get(0);
		}
		else {
			return null;
		}
	}

}
